//
//  BlankLine.swift
//  jocool
//
//  Created by tong on 16/6/20.
//  Copyright © 2016年 zhuxietong. All rights reserved.
//

import UIKit
import Eelay
public protocol LineHeight {
    static var height:CGFloat{get set}
}



public struct line {
    public struct px1:LineHeight {public static var height: CGFloat = 1}
    public struct px2:LineHeight {public static var height: CGFloat = 2}
    public struct px3:LineHeight {public static var height: CGFloat = 3}
    public struct px4:LineHeight {public static var height: CGFloat = 4}
    public struct px5:LineHeight {public static var height: CGFloat = 5}
    public struct px6:LineHeight {public static var height: CGFloat = 6}
    public struct px7:LineHeight {public static var height: CGFloat = 7}
    public struct px8:LineHeight {public static var height: CGFloat = 8}
    public struct px9:LineHeight {public static var height: CGFloat = 9}
    public struct px10:LineHeight {public static var height: CGFloat = 10}
    public struct px11:LineHeight {public static var height: CGFloat = 11}
    
    public struct px12:LineHeight {public static var height: CGFloat = 12}
    public struct px13:LineHeight {public static var height: CGFloat = 13}
    
    public struct px14:LineHeight {public static var height: CGFloat = 14}
    
    public struct px15:LineHeight {public static var height: CGFloat = 15}
    
    public struct px16:LineHeight {public static var height: CGFloat = 16}
    
    public struct px17:LineHeight {public static var height: CGFloat = 17}
    public struct px18:LineHeight {public static var height: CGFloat = 18}
    public struct px19:LineHeight {public static var height: CGFloat = 19}
    public struct px20:LineHeight {public static var height: CGFloat = 20}
    public struct px21:LineHeight {public static var height: CGFloat = 21}
    public struct px22:LineHeight {public static var height: CGFloat = 22}
    public struct px23:LineHeight {public static var height: CGFloat = 23}
    public struct px24:LineHeight {public static var height: CGFloat = 24}
    public struct px25:LineHeight {public static var height: CGFloat = 25}
    public struct px26:LineHeight {public static var height: CGFloat = 26}
    public struct px27:LineHeight {public static var height: CGFloat = 27}
    public struct px28:LineHeight {public static var height: CGFloat = 28}
    public struct px29:LineHeight {public static var height: CGFloat = 29}
    public struct px30:LineHeight {public static var height: CGFloat = 30}
    public struct px31:LineHeight {public static var height: CGFloat = 31}
    public struct px32:LineHeight {public static var height: CGFloat = 32}
    public struct px33:LineHeight {public static var height: CGFloat = 33}
    public struct px34:LineHeight {public static var height: CGFloat = 34}
    public struct px35:LineHeight {public static var height: CGFloat = 35}
    public struct px36:LineHeight {public static var height: CGFloat = 36}
    public struct px37:LineHeight {public static var height: CGFloat = 37}
    public struct px38:LineHeight {public static var height: CGFloat = 38}
    
    
    public struct px39:LineHeight {public static var height: CGFloat = 39}
    
    public struct px40:LineHeight {public static var height: CGFloat = 40}
    
    public struct px42:LineHeight {public static var height: CGFloat = 42}
    public struct px44:LineHeight {public static var height: CGFloat = 44}
    
    
    public struct px48:LineHeight {public static var height: CGFloat = 48}
    
    public struct px52:LineHeight {public static var height: CGFloat = 52}
    
    public struct px56:LineHeight {public static var height: CGFloat = 56}
    
    public struct px60:LineHeight {public static var height: CGFloat = 60}
    
    public struct px64:LineHeight {public static var height: CGFloat = 64}
    
    public struct px68:LineHeight {public static var height: CGFloat = 68}
    
    public struct px72:LineHeight {public static var height: CGFloat = 72}
    
    public struct px74:LineHeight {public static var height: CGFloat = 74}
    
    public struct px80:LineHeight {public static var height: CGFloat = 80}
    
    public struct px88:LineHeight {public static var height: CGFloat = 88}
    
    public struct px92:LineHeight {public static var height: CGFloat = 92}
    
    public struct px100:LineHeight {public static var height: CGFloat = 100}
    
    public struct px120:LineHeight {public static var height: CGFloat = 120}
    
    public struct px150:LineHeight {public static var height: CGFloat = 150}
    
    public struct px160:LineHeight {public static var height: CGFloat = 160}
    
    public struct px170:LineHeight {public static var height: CGFloat = 170}
    
    public struct px180:LineHeight {public static var height: CGFloat = 180}
    
    
    
    
    
}


public class BlankCol<Line:LineHeight>:JoCollectionCell {
    
    public var line = UIView()
    
    public override func _height() -> CGFloat {
        return Line.height
    }
    
    override public func addLayoutRules() {
        line = UIView()//关键语句否则会报错，misssuperview
        contentView.addSubview(line)
        contentView.eelay = [
            [line,[ee.T.L.B.R],"\(Line.height)"]
        ]
        
        //        line.LE((0,0,0,0),p:800){
        //            $0.height.equalTo(Line.height)
        //        }
        contentView.backgroundColor = .clear
        self.backgroundColor = .clear
    }
    
    open override func mo_model_reload(){
        
        let hexStr = mo.model["hex",AppTheme.table_bg_hex]
        line.bsui.background(hex: hexStr)
    }
    
}

public class BlankLine<Line:LineHeight>:JoTableCell {
    
    public var line = UIView()
    override public func addLayoutRules() {
        line = UIView()//关键语句否则会报错，misssuperview
        contentView.addSubview(line)
        contentView.eelay = [
            [line,[ee.T.L.B.R],"\(Line.height)"]
        ]
        
        
        contentView.backgroundColor = .clear
        self.backgroundColor = .clear
    }
    
    open override func mo_model_reload() {
        if let backgroundColor = mo.model["backgroundColor"] as? UIColor{
            line.backgroundColor = backgroundColor
        }
        if let hex = mo.model["hex"] as? String{
            line.bsui.background(hex: hex)
        }
        
    }
}

public class WhiteLine<Line:LineHeight>:JoTableCell {
    
    public var line = UIView()
    override public func addLayoutRules() {
        line = UIView()//关键语句否则会报错，misssuperview
        contentView.eelay = [
            [line,[ee.T.L.B.R],"\(Line.height)"]
        ]
        
        //        contentView.addSubview(line)
        //        line.LE((0,0,0,0),p:800){
        //            $0.height.equalTo(Line.height)
        //        }
        //        line.backgroundColor = _table_bk_color
    }
    
    open override func mo_model_reload() {
        let hexStr = mo.model["hex","#fff"]
        line.bsui.background(hex: hexStr)
    }
}


